lst = [
    "xcvuh",
    "kjbnmnb",
    "oijn bn"
]

#使用with可以保证即使出现异常，也可以关闭文件
with open("c.txt","w",encoding="utf-8") as f:
    #推导式，给每个元素换行
    lst = [item+"\n" for item in lst]
    f.writelines(lst)
    
print("close:",f.close) #打印是否关闭